const KoaRouter = require('koa-router');
const adminController = require('../controllers/adminController.js');
const authController = require('../controllers/authController.js');
const categoryController = require('../controllers/categoryController.js');
const productController = require('../controllers/productController.js');
const router = new KoaRouter();

router.post('/admin/register', adminController.registerAdmin);
router.post('/admin/add', adminController.addAdmin);
router.post('/admin/adminLogout', adminController.adminLogout);
router.post('/admin/delete', adminController.deleteAdmin);
router.post('/admin/update', adminController.updateAdmin);
router.post('/admin/updateMyProfile', adminController.updateMyProfile);
router.post('/admin/updateMyPassword', adminController.updateMyPassword);
router.post('/admin/login', adminController.loginAdmin);
router.get('/admin/info', adminController.adminInfo);
router.get('/admin/getAdminListByPage', adminController.getAdminListByPage);

router.get('/refreshToken', authController.refreshToken);

router.post('/category', categoryController.addCategory);
router.delete('/category/:id', categoryController.deleteCategory);
router.put('/category', categoryController.updateCategory);
router.get('/category/list', categoryController.getCategoryListByPage);
router.get('/category/:id', categoryController.getCategoryInfo);
router.get('/categorys', categoryController.getAllCategorys);

router.post('/product', productController.addProduct);
router.delete('/product/:id', productController.deleteProduct);
router.put('/product', productController.updateProduct);
router.get('/product/list', productController.getProductListByPag);
router.get('/product/:id', productController.getProductInfo);

module.exports = router;
